
package proyecto1;


public class IngresoEmpresa extends javax.swing.JDialog {

    /** Creates new form IngresoEmpresa */
    public IngresoEmpresa(java.awt.Frame parent, boolean modal) {
        super(parent, modal);
        initComponents();
        this.setLocationRelativeTo(null);
    }

   
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel3 = new javax.swing.JLabel();
        TextoCodigo = new javax.swing.JTextField();
        TextoRut = new javax.swing.JTextField();
        TextoGuardar = new javax.swing.JButton();
        TextoBorrar = new javax.swing.JButton();
        jLabel2 = new javax.swing.JLabel();
        TextoNombre = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        TextoDireccion = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        TextoTelefono = new javax.swing.JTextField();
        jLabel6 = new javax.swing.JLabel();
        TextoFax = new javax.swing.JTextField();
        jLabel7 = new javax.swing.JLabel();
        TextoCorreo = new javax.swing.JTextField();
        jLabel8 = new javax.swing.JLabel();
        Volver = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.DISPOSE_ON_CLOSE);

        jLabel1.setText("Codigo: ");

        jLabel3.setText("Rut: ");

        TextoCodigo.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TextoCodigoActionPerformed(evt);
            }
        });

        TextoGuardar.setText("Guardar Cambios");
        TextoGuardar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TextoGuardarActionPerformed(evt);
            }
        });

        TextoBorrar.setText("Borrar");
        TextoBorrar.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                TextoBorrarActionPerformed(evt);
            }
        });

        jLabel2.setText("Nombre: ");

        jLabel4.setText("Dirección: ");

        jLabel5.setText("Teléfono: ");

        jLabel6.setText("Fax: ");

        jLabel7.setText("Correo de Contacto: ");

        jLabel8.setFont(new java.awt.Font("Shonar Bangla", 0, 48)); // NOI18N
        jLabel8.setText("Formulario Empresa");

        Volver.setText("Volver al menu");
        Volver.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                VolverActionPerformed(evt);
            }
        });

        org.jdesktop.layout.GroupLayout layout = new org.jdesktop.layout.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .add(31, 31, 31)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING, false)
                    .add(layout.createSequentialGroup()
                        .add(TextoGuardar)
                        .add(98, 98, 98)
                        .add(TextoBorrar)
                        .add(121, 121, 121)
                        .add(Volver))
                    .add(layout.createSequentialGroup()
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabel4)
                            .add(jLabel2)
                            .add(jLabel5)
                            .add(jLabel6)
                            .add(jLabel7)
                            .add(jLabel3)
                            .add(jLabel1))
                        .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                        .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                            .add(jLabel8)
                            .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING, false)
                                .add(org.jdesktop.layout.GroupLayout.LEADING, TextoCorreo)
                                .add(org.jdesktop.layout.GroupLayout.LEADING, TextoFax)
                                .add(org.jdesktop.layout.GroupLayout.LEADING, TextoTelefono)
                                .add(org.jdesktop.layout.GroupLayout.LEADING, TextoDireccion)
                                .add(org.jdesktop.layout.GroupLayout.LEADING, TextoNombre)
                                .add(org.jdesktop.layout.GroupLayout.LEADING, TextoRut)
                                .add(org.jdesktop.layout.GroupLayout.LEADING, TextoCodigo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 124, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)))))
                .addContainerGap(84, Short.MAX_VALUE))
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
            .add(layout.createSequentialGroup()
                .addContainerGap()
                .add(jLabel8)
                .add(20, 20, 20)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.TRAILING)
                    .add(jLabel1)
                    .add(TextoCodigo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(TextoRut, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(jLabel3))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel2, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, 19, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE)
                    .add(TextoNombre, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(18, 18, 18)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel4)
                    .add(TextoDireccion, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .add(18, 18, 18)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel5)
                    .add(TextoTelefono, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.UNRELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.LEADING)
                    .add(jLabel6)
                    .add(TextoFax, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(jLabel7)
                    .add(TextoCorreo, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE, org.jdesktop.layout.GroupLayout.DEFAULT_SIZE, org.jdesktop.layout.GroupLayout.PREFERRED_SIZE))
                .addPreferredGap(org.jdesktop.layout.LayoutStyle.RELATED, 85, Short.MAX_VALUE)
                .add(layout.createParallelGroup(org.jdesktop.layout.GroupLayout.BASELINE)
                    .add(TextoGuardar)
                    .add(TextoBorrar)
                    .add(Volver))
                .add(35, 35, 35))
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

private void TextoCodigoActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TextoCodigoActionPerformed
// TODO add your handling code here:
}//GEN-LAST:event_TextoCodigoActionPerformed

private void TextoGuardarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TextoGuardarActionPerformed

     EmpresasClientes ec = new  EmpresasClientes();
     ec.setNombre(TextoNombre.getText());
     ec.setCodigo(TextoCodigo.getText());
     ec.setRut(TextoRut.getText());
     ec.setCorreoContacto(TextoCorreo.getText());
     ec.setDireccion(TextoDireccion.getText());
     ec.setFax(TextoFax.getText());
     ec.setTelefono(TextoTelefono.getText());
    Main.datosEm.add(ec);
    
    
    
    
    this.setVisible(false); // para esconder la ventana
    Main.contadorE++;
    
}//GEN-LAST:event_TextoGuardarActionPerformed

private void TextoBorrarActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_TextoBorrarActionPerformed
TextoCodigo.setText(""); // le sete al texto un espacio vacio para borrar
TextoRut.setText("");
TextoNombre.setText("");
TextoCorreo.setText("");
TextoDireccion.setText("");
TextoFax.setText("");
TextoTelefono.setText("");







    
}//GEN-LAST:event_TextoBorrarActionPerformed

    private void VolverActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_VolverActionPerformed
      this.setVisible(false);
    }//GEN-LAST:event_VolverActionPerformed

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /* Set the Nimbus look and feel */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /* If Nimbus (introduced in Java SE 6) is not available, stay with the default look and feel.
         * For details see http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html 
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(IngresoEmpresa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(IngresoEmpresa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(IngresoEmpresa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(IngresoEmpresa.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /* Create and display the dialog */
        java.awt.EventQueue.invokeLater(new Runnable() {

            public void run() {
                IngresoEmpresa dialog = new IngresoEmpresa(new javax.swing.JFrame(), true);
                dialog.addWindowListener(new java.awt.event.WindowAdapter() {

                    @Override
                    public void windowClosing(java.awt.event.WindowEvent e) {
                        System.exit(0);
                    }
                });
                dialog.setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton TextoBorrar;
    private javax.swing.JTextField TextoCodigo;
    private javax.swing.JTextField TextoCorreo;
    private javax.swing.JTextField TextoDireccion;
    private javax.swing.JTextField TextoFax;
    private javax.swing.JButton TextoGuardar;
    private javax.swing.JTextField TextoNombre;
    private javax.swing.JTextField TextoRut;
    private javax.swing.JTextField TextoTelefono;
    private javax.swing.JButton Volver;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JLabel jLabel6;
    private javax.swing.JLabel jLabel7;
    private javax.swing.JLabel jLabel8;
    // End of variables declaration//GEN-END:variables
}
